package com.jason.www.state_pattern.demo1.state;


import com.jason.www.state_pattern.demo1.context.RoomContext;

/**
 * 房间入住状态
 */
public class RoomCheckInState implements IRoomState {
    RoomContext context;

    public RoomCheckInState(RoomContext context) {
        this.context = context;
    }

    @Override
    public void bookRoom() {
        //不需要做操作
    }

    @Override
    public void unsubscribeRoom() {

    }

    @Override
    public void checkInRoom() {
        throw new RuntimeException("不需要做操作，执行checkIn操作失败");
    }

    @Override
    public void checkOutRoom() {
        System.out.println("您已经成功退房了...");
        context.setState(context.getBookedState());
    }
}
